package com.wxc.thread;

import com.wxc.util.ConnectionUtil;

import java.util.Collection;
import java.util.concurrent.TimeUnit;

/**
 * @author wxc
 * @date 2021年10月07日 19:18
 */
public class PushMessageThread extends Thread {

    @Override
    public void run() {
        while(true) {
            try {
                TimeUnit.SECONDS.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            Collection<ConnectionThread> connectionThreads = ManageConnectionThreads.getValues();
            for (ConnectionThread connectionThread : connectionThreads) {
                connectionThread.push("Server push Message");
            }
        }
    }

}
